package outlierDetector;

import data.DataPoint;
import org.apache.beam.sdk.transforms.DoFn;

import java.util.ArrayList;

/**
 * Created by emily on 17-12-15.
 */
public class StaticThresholdDetector extends DoFn<ArrayList<DataPoint>, DataPoint> {

    private double threshold = 0.0;

    public StaticThresholdDetector(double threshold){
        this.threshold = threshold;

    }

    @ProcessElement
    public void processElement(ProcessContext c) {

        for (DataPoint dp : c.element()) {
            System.out.println(dp.timestamp + ": " + dp.value);
            if (dp.value > 1.0) {
                c.output(dp);
            }
        }
    }
}
